organics = input()
e_organics = ''
l = len(organics)
for i in range(l):
    e = organics[i]
    if i < l - 1:
        if '0' <= organics[i + 1] <= '9':
            a = int(organics[i + 1])
            e = a * organics[i]
            i += 1
    e_organics += e
    e_num = {}
for i in e_organics:
    e_num[i] = e_organics.count(i)
coo = e_num['C']
hho = e_num['H']/2
print(coo, int(hho))
